def hello(fn):
    def wrapper():
        print("hello, %s" % fn.__name__)
        fn()
        print("goodby, %s" % fn.__name__)
    return wrapper


@hello
def foo():
    print("i am foo")


# foo()



def log(text):
    def decorator(func):
        def wrapper(*args, **kw):
            print('%s %s():' % (text, func.__name__))
            return func(*args, **kw)
        return wrapper
    return decorator



@log('execute')
def now():
    print('2015-3-25')


# now()


def logT(fun):
    def wrapper(*args, **kw):
        print('%s():' % fun.__name__)
        fun()
        print("wq vb wq")
    return wrapper


@logT
def msge():
    print("你好你好")


# msge()





import functools

def log(*argu):
   def decorator(func):
      @functools.wraps(func)
      def wrapper(*args, **kw):
         print('begin call')
         print ('%s:' % func.__name__,)
         for i in argu:
            print (i,)
         print ('\nend call')
      return wrapper
   return decorator

@log('Rachel', 'Monica', 'Phoebe')
# @log()
def friends():
   pass


friends()

